import React, {Component} from 'react';
import axios from 'axios'
class ShopList extends Component {
    constructor(props){
        super(props)
        this.state = {
            list : []
        }
    }
    render() {
        return (
            <div className="shopList">
                {
                    this.state.list.map((item,index)=>{
                        return (
                            <dl key={index}>
                                <dt>
                                    <img src={item.image} alt=""/>
                                </dt>
                                <dd>
                                    {item.title}
                                </dd>
                            </dl>
                        )
                    })
                }
            </div>
        );
    }
    componentDidMount() {
        axios.get('http://vueshop.glbuys.com/api/home/index/nav?token=1ec949a15fb709370f').then((res)=>{
            console.log(res)
            const data = res.data.data
            this.setState({
                list : data
            })
        })
    }
}

export default ShopList;